//
//  JijinDetailCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/17.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "JijinDetailCell.h"

@implementation JijinDetailCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        CGFloat baseHeight = kScreenIp6(80);
        CGFloat baseY = kScreenIp6(15);
        CGFloat baseX = kScreenIp6(10);
        CGFloat baseWidth = kScreenWidth - baseX;
        self.baseView = [[UIView alloc] initWithFrame:CGRectMake(baseX, baseY, baseWidth, baseHeight)];
        [self addSubview:_baseView];
        
        UIImageView *baseImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenIp6(100), baseHeight)];
        baseImage.image = [UIImage imageNamed:@"header_bg_black@2x"];
        self.showImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, kScreenIp6(10), kScreenIp6(100), baseHeight - kScreenIp6(20))];
        [baseImage addSubview:_showImage];
        [self.baseView addSubview:baseImage];
        
        self.length = [[UILabel alloc] initWithFrame:CGRectMake(kScreenIp6(50), CGRectGetMaxY(baseImage.frame) - kScreenIp6(20), kScreenIp6(50), kScreenIp6(20))];
        self.length.font = [UIFont systemFontOfSize:12];
        self.length.textAlignment = 1;
        self.length.textColor = [UIColor whiteColor];
        self.length.backgroundColor = [UIColor blackColor];
        [self.baseView addSubview:_length];
        
        CGFloat labelWidth = baseWidth - baseImage.bounds.size.width - kScreenIp6(20);
        self.title = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(baseImage.frame) + kScreenIp6(10), 0, labelWidth, kScreenIp6(60))];
        self.title.numberOfLines = 0;
        self.title.font = [UIFont systemFontOfSize:14];
        [self.baseView addSubview:_title];
        
        self.modtime = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - kScreenIp6(100), CGRectGetMaxY(baseImage.frame) - kScreenIp6(20), kScreenIp6(80), kScreenIp6(20))];
        self.modtime.textColor = [UIColor grayColor];
        self.modtime.textAlignment = 2;
        self.modtime.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_modtime];
        
        
        //线
        UIView *footLineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, kScreenIp6(109), kScreenWidth, 0.5)];
        
        footLineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];
        
        [self addSubview:footLineView];
        
        
        
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}


- (void)setModelWith:(JijinVideoDetailModel *)model
{
    [self.showImage setImageWithURL:[NSURL URLWithString:model.imgUrl] placeholderImage:[UIImage imageNamed:@"no_pic"]];
    
    self.length.text = model.blength;
    
    self.title.text = model.name;
    
    self.modtime.text = model.modtime;
}

@end
